home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
The World of Computer Software.iso
/
pdox35sc.zip
/
PRINTER.SC
< prev
next >
Wrap
Text File
|
1991-06-10
|
50KB
|
915 lines
; ***************************************************************************************
; GENERIC PRINTING UTILITY
; Copyright 1991 Virginia B. Sauer All Rights Reserved
; This program may be copied/modified without charge provided both that this
; copyright notice is included without change, and that any accompanying
; documentation includes the notice "Portions of code (c) Copyright 1991,
; Virginia B. Sauer"
; ***************************************************************************************
; When creating applications, it is often impossible to know which printer(s) will be
; utilized ... Even when such information is readily available, printers can be changed,
; systems run at multiple locations, and designations varied on multi-user LAN versions.
; Apart from the inconvenience of individually updating reports, many novices are
; unfamiliar with the necessary procedures.
; To forestall such problems, the following utility has been developed to walk the user
; through automatically designating and modifying all printer settings, ensuring that the
; printer is online, et cetera. As this is completely generic, it can effortlessly be
; incorporated into any application you design.
; ************ IMPORTANT NOTE ************
; This utility also requires a special table and data entry form. Such procedures are
; clearly outlined in your Paradox manual. As this column is intended to provide a
; generic utility (rather than an introduction to Paradox), space constraints preclude
; citing step-by-step procedures herein. Nevertheless, for the sake of novices (and to
; ensure that this utility is presented in its entirety), a program is included to
; automatically create all necessary tables, forms, validity checks, et cetera.
; ********************************************************************************
; To invoke this procedure, you will need to create a table named Printer, with
; with the following structure. (As explained in the introduction, procedures are
; outlined in your Paradox manual, and a program to automatically create the table
; [replete with validity checks] is included beneath the sample.)
; ********************************************************************************
; ╔═════════════════════════════════════════════════════════════════════════════════════╗
; ║ P R I N T E R T A B L E ║
; ╟───────────────┬──────┬─────────┬────────────────────────────────┬───────────────────╢
; ║ │ │ │ │ Description ║
; ║ Field Name │ Type │ Default │ Validity Check (Picture) │ of ║
; ║ │ │ │ │ Validity Check ║
; ╠═══════════════╪══════╪═════════╪════════════════════════════════╪═══════════════════╣
; ║ │ │ │ │ Proper case (cap- ║
; ║ [NAME] │ A38* │ │ !*[{ ,-[ ],.[ ],;,[ ]}!,@] │ italize first let ║
; ║ │ │ │ │ ter of each word) ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ │ │ │ │ landscape ║
; ║ [ORIENTATION] │ A9* │ │ {landscape,portrait} │ or ║
; ║ │ │ │ │ portrait ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ │ │ │ │ condensed, ║
; ║ [PITCH] │ A9* │ │ {condensed,elite,pica} │ elite, or pica ║
; ║ │ │ │ │ type ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ [LENGTH] │ A2 │ │ *# │ All numbers ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ │ │ │ │ All capital ║
; ║ [PORT] │ A4 │ LPT1 │ *! │ letters ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ │ │ │ │ All numbers and ║
; ║ [SETUP] │ A30 │ │ *{!, } │ capitalized ║
; ║ │ │ │ │ letters ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ [PICK] │ A1 │ │ X │ X ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ │ │ │ │ Dot Matrix, ║
; ║ [TYPE] │ A10 │ │ {Dot Matrix,Ink Jet,Laser Jet} │ Ink Jet, or ║
; ║ │ │ │ │ Laser Jet ║
; ║───────────────┼──────┼─────────┼────────────────────────────────┼───────────────────╢
; ║ [CODE] │ A1 │ │ *# │ All numbers ║
; ╚═══════════════╧══════╧═════════╧════════════════════════════════╧═══════════════════╝
; ----- Invoke the following procedures ONLY if you want to automatically create the
; above table and validity checks ... They will not be used in the actual printer
; utility
If not Istable("Printer")
Then Create "Printer"
"NAME" : "A38*",
"ORIENTATION" : "A9*" ,
"PITCH" : "A9*" ,
"LENGTH" : "A2" ,
"PORT" : "A4" ,
"SETUP" : "A30" ,
"PICK" : "A1" ,
"TYPE" : "A10" ,
"CODE" : "A1"
Edit "PRINTER"
{ValCheck} {Define} Enter {Picture} {!*[{ ,-[ ],.[ ],;,[ ]\}!,@]} Enter
{ValCheck} {Define} Enter {Picture} {landscape,portrait} Enter
{ValCheck} {Define} Enter {Picture} {condensed,elite,pica} Enter
{ValCheck} {Define} Enter {Picture} {*#} Enter
{ValCheck} {Define} Enter {Picture} {*!}
{ValCheck} {Define} Enter {Default} {LPT1} Enter
{ValCheck} {Define} Enter {Picture} {*{!, \}} Enter
{ValCheck} {Define} Enter {Picture} {X} Enter
{ValCheck} {Define} Enter {Picture} {Dot Matrix,Ink Jet,Laser Jet} Enter
{ValCheck} {Define} Enter {Picture} {*#} Enter
Del ;- Delete record created by default value
Do_It!
; ----- Modify this segment to incorporate the printer configurations required by your
; application.
; For example, whereas a complete system would offer all options (landscape and
; portrait modes, every pitch, et cetera), such an array would prove confusing in
; a runtime version designed solely for 16.6H characters per inch).
; Likewise, if you know which printer(s) will be used by the end user, make
; certain to incorporate their names and setup strings in the Printer table.
Edit "Printer"
"Hewlett Packard Laser Jet Series I" Down ; Enter names of all
"Hewlett Packard Laser Jet Series II" Down ; printers "known" to
"Hewlett Packard Laser Jet Series II-P" Down ; be used by your end
"Hewlett Packard Laser Jet Series III" Down ; user
"IBM-Compatible Dot Matrix Printer" Home Right ; Move to next field
"P" Right ; Autofill portrait
"C" Right ; Autofill condensed
"80" Right ; Length
"LPT1" Right ; Port
"\\027E\\027(s16.66H\\027&l8D" Right Right ; Setup ... Skip "Pick"
"L" End ; Autofill Laser Jet
"D" Left Left ; Autofill Dot Matrix
"\\027W\\000\\015" Home ; Setup for Dot Matrix
For Counter from 1 to Nfields("Printer") ; Copy preceding field values
Scan for Isblank([]) ; where applicable
Ditto
Endscan
Right
Endfor
Do_It!
Endif
; ********************************************************************************
; After creating the aforementioned table, design a data entry form. (As stated
; in the introduction, procedures are outlined in your Paradox manual, and a
; program to automatically create the form is included beneath the sample.)
; ********************************************************************************
; ╔══════════════════════════════════════════════════════════════════════════════╗
; ║ PRINTER NAME: ______________________________________ ║
; ║ (e. g., Epson FX-286E) ║
; ║─────────────────────────────┬────────────────────────────┬───────────────────║
; ║ REPORT PAGE LENGTH: __ │ PRINTER TYPE: __________ │ PORT: ____ ║
; ║ (Check your printer guide) │ (Dot Matrix/Laser/Ink Jet) │ Default = LPT1 ║
; ║─────────────────────────────┴────────────────────────────┴───────────────────║
; ║ ║
; ║ SETUP STRING: __________________________________________________ ║
; ║ ║
; ║ Setup strings can be found in the manual that accompanied your printer. ║
; ║ ║
; ║ If you have a laser jet or IBM-compatible printer with ║
; ║ graphics capability, please specify the appropriate ║
; ║ graphics-quality escape sequence for your printer. ║
; ║ ║
; ║ If your printer does not have graphics capability, ║
; ║ specify the string for your printer. (The reports will ║
; ║ then be printed without graphics characters or boxes.) ║
; ║ ║
; ║──────────────────────────────────────────────────────────────────────────────║
; ║ Press the <F2> key when finished, or the <Esc> key to quit ║
; ╚══════════════════════════════════════════════════════════════════════════════╝
; ----- Invoke the following procedures ONLY if you want to automatically design the
; above form ... They will not be used in the actual printer utility
If not IsFile("Printer.F1")
Then Proc Position_Cursor(Rownum,Colnum)
Home CtrlHome
While Rowno() < Rownum Down Endwhile
While Colno() < Colnum Right Endwhile
Endproc
Proc Place_Border(LineType)
LineType = LineType + "-Line"
{Border} {Place} Select LineType Enter
Endproc
{Forms} {Design} {PRINTER} {1} {ENTER PRINTER CODES}
Place_Border("Double") Position_Cursor(23,80) Enter
Position_Cursor(04,02) Place_Border("Single") Position_Cursor(04,79) Enter
Position_Cursor(07,02) Place_Border("Single") Position_Cursor(07,79) Enter
Position_Cursor(21,02) Place_Border("Single") Position_Cursor(21,79) Enter
Position_Cursor(05,31) Place_Border("Single") Down Enter
Position_Cursor(06,31) Enter
Position_Cursor(05,60) Place_Border("Single") Down Enter
Position_Cursor(06,60) Enter
Position_Cursor(04,31) Typein "\194" Position_Cursor(04,60) Typein "\194"
Position_Cursor(07,31) Typein "\193" Position_Cursor(07,60) Typein "\193"
Position_Cursor(02,14) Typein "PRINTER NAME: "
{Field} {Place} {Regular} {NAME} Enter Enter
Position_Cursor(03,37) Typein "(e. g., Epson FX-286E)"
Position_Cursor(05,05) Typein "REPORT PAGE LENGTH: "
{Field} {Place} {Regular} {LENGTH} Enter Enter
Position_Cursor(05,34) Typein "PRINTER TYPE: "
{Field} {Place} {Regular} {TYPE} Enter Enter
Position_Cursor(05,64) Typein "PORT: "
{Field} {Place} {Regular} {PORT} Enter Enter
Position_Cursor(06,04) Typein "(Check your printer guide)"
Position_Cursor(06,33) Typein "(Dot Matrix/Laser/Ink Jet)"
Position_Cursor(06,63) Typein "Default = LPT1"
Position_Cursor(09,08) Typein "SETUP STRING: "
{Field} {Place} {Regular} {SETUP} Enter Enter
Position_Cursor(11,05)
Typein "Setup strings can be found in the manual that accompanied your printer."
Position_Cursor(13,11) Typein "\04"
Position_Cursor(13,16)
Typein "If you have a laser jet or IBM-compatible printer with"
Position_Cursor(14,16)
Typein "graphics capability, please specify the appropriate"
Position_Cursor(15,16)
Typein "graphics-quality escape sequence for your printer."
Position_Cursor(17,11) Typein "\04"
Position_Cursor(17,16)
Typein "If your printer does not have graphics capability,"
Position_Cursor(18,16)
Typein "specify the string for your printer. (The reports"
Position_Cursor(19,16)
Typein "will then be printed without graphics characters or boxes.)"
Position_Cursor(22,03) Typein " Press the <F2> key when finished,"
+ " or the <Esc> key to quit "
Do_It!
Endif
; --- If necessary, move the Printer table and form to the appropriate directory (e. g.,
; if you place lookup tables in a subdirectory named LookUp, the Printer table would
; probably belong there). To accomplish this, follow the Paradox menu selections:
; {Tools} {Rename} {Table} {Printer} {LookUp\\Printer}.
;********************************************************************************
; THE PRINTER CONFIGURATION UTILITY BEGINS HERE
;********************************************************************************
; ╔══════════════════════════════════════════════════════════════════════════════════════╗
; ║ PARAMETERS PASSED TO THIS PROCEDURE ║
; ║ (Unless these are variables, each must be enlosed in quotation marks.) ║
; ╟───────────┬───────────────────────────────────────────────────────┬──────────────────╢
; ║ ARGUMENT │ DESCRIPTION │ SAMPLE ║
; ╟───────────┼───────────────────────────────────────────────────────┼──────────────────╢
; ║ │ The page orientation (vertical or horizontal): │ "Portrait" ║
; ║Orientation│ "Portrait" (to signify vertical as for a letter) │ (To signify ║
; ║ │ "Landscape" (to signify horizontal, or sideways) │ vertical) ║
; ╟───────────┼───────────────────────────────────────────────────────┼──────────────────╢
; ║ │ The number of characters to be printed per inch: │ "Pica" ║
; ║ Pitch │ "Condensed" (for condensed pitch, 16.6 cpi) │ ║
; ║ │ "Elite" (for elite pitch, 12 cpi) │ (To print 10 ║
; ║ │ "Pica" (for pica pitch, 10 cpi) │ cpi) ║
; ╟───────────┼───────────────────────────────────────────────────────┼──────────────────╢
; ║ │ The length of the paper to be used: │ "11" ║
; ║PaperLength│ "11" (for letter-sized paper, 8 1/2 x 11 inches) │ (To signify paper║
; ║ │ "14" (for legal-sized paper, 8 1/2 x 14 inches) │ 11 inches long) ║
; ╟───────────┼───────────────────────────────────────────────────────┼──────────────────╢
; ║ │ The name of the printer table (e. g., "Printer", if │ "Printer" ║
; ║PrinterTbl │ it is in the current directory, or "Lookup\\Printer", │(To signify that ║
; ║ │ if it is in a subdirectory named Lookup) │printer table is ║
; ║ │ │named "Printer") ║
; ╟───────────┼───────────────────────────────────────────────────────┼──────────────────╢
; ║ │ Whether or not the reports are to be printed at this │ "Yes" ║
; ║ PrintNow │ time (as opposed to merely configuring the printer): │ (To signify that ║
; ║ │ "Yes" (if reports are to be printed now) │ reports are to ║
; ║ │ "No" (if reports are not to be printed now) │ be printed now) ║
; ╚═══════════╧═══════════════════════════════════════════════════════╧══════════════════╝
Release procs all Release vars all
Run NoRefresh "Del Print.lib" ; Ensure that the library exists
Libname = "Print" ; (If desired, modify this segment to
If not isfile(Libname + ".lib") ; add the procedures to a library of
Then Createlib Libname ; your choice, such as LIB\\Print if
Endif ; you use RDA.)
; ---- Set up printer for the specified reports
Proc Setup_Printer(Orientation,Pitch,PaperLength,PrinterTbl,PrintNow)
While true
Configure_Printer()
If Upper(PrintNow) = "YES" ; If ready to print now (rather than
Then Check_Printer() ; just configuring printer)
Endif
Quitloop
EndWhile
Endproc
Writelib Libname Setup_Printer
Release procs Setup_Printer
?? ""
; ---- change/assign default configurations
Proc Select_Printer()
Private Choice ;- user's choice
Clear Clearall
Edit PrinterTbl
Menu {Image} {Move} {PICK} Enter ; Move selection field to left column
Scan
[PICK] = "" ; Remove previous default selection
Endscan
Home ; Return to first record
Moveto [PICK]
;-- Define and center first and second lines of prompt statement
Prompt1 = Format("W80,AC","Using arrows to move around, place an X alongside the correct printer. (Press")
Prompt2 = Format("W80,AC","<Ins> key if it is not listed.) Press <F2> key when finished, or <Esc> to quit.")
While True
Wait table
Prompt Prompt1, Prompt2
Until "F2", "Esc", "Ins", "Del", "DOS", "DOSBig"
Switch
Case RetVal = "F2" : Do_It!
Quitloop
Case RetVal = "Ins" : Add_Printer()
QuitLoop
Case RetVal = "Del" : Beep ;- Get the user's attention
Showmenu ;- show options
"Cancel": "Cancel Deletion: Do not delete this record",
"Delete": "It is okay to delete this record"
To choice
If choice = "Delete" ;- only delete record if confirmed
Then Del
Loop
Endif
Case RetVal = "Esc" : CancelEdit
Clear ClearAll
Quit
Case RetVal = 15 ;- Trap for user entering Alt-O
or Retval = -24 : Loop ;- or Ctrl-O in error
EndSwitch
EndWhile
Reset {Ask} Select PrinterTbl "Delete"
Moveto [NAME] "Blank"
Do_It!
Endproc
Writelib Libname Select_Printer
Release procs Select_Printer
?? ""
;---- Complete descriptions of variables for prompt statement
Proc Prompt_Descriptions()
Switch
Case PaperLength = "11" : PaperLength = "letter"
Case PaperLength = "14" : PaperLength = "legal"
EndSwitch
Switch ; last parenthesis is added later (in prompt statement)
Case Upper(Pitch) = "CONDENSED" : Pitch = "condensed print (16.6"
Font = "16.6H"
Case Upper(Pitch) = "ELITE" : Pitch = "elite print (12"
Font = "12.0H"
Case Upper(Pitch) = "PICA" : Pitch = "pica print (10"
Font = "10.0H"
EndSwitch
If Upper(Orientation) = "PORTRAIT"
then Orientation = "portrait (vertical, as for a letter)"
else Orientation = "landscape (horizontal, or sideways)"
Endif
Endproc
Writelib Libname Prompt_Descriptions
Release procs Prompt_Descriptions
?? ""
; ---- Assign printer codes
Proc Assign_PrinterCodes()
Reset {Ask} Select PrinterTbl
Moveto [NAME] "..\" I\""
Moveto [CODE] "Changeto 1" Down
Moveto [NAME] "..\" II\" or ..\" II-P\""
Moveto [CODE] "Changeto 2" Down
Moveto [NAME] "..\" III\""
Moveto [CODE] "Changeto 3" Down
Moveto [TYPE] "Dot Matrix"
Moveto [CODE] "Changeto 4"
Do_It!
Endproc
Writelib Libname Assign_PrinterCodes
Release procs Assign_PrinterCodes
?? ""
; ---- Delete blank records and check for missing fields
Proc Required_Fields(Fieldname)
While true
Moveto Field Fieldname
If isblank([])
Then If Fieldname = "PORT"
Then [PORT] = "LPT1"
Else Fieldname = lower(Fieldname)
Prompt1 = Format("W80,AC","You have not yet entered the " + Fieldname + ". Please do so now")
Prompt2 = Format("W80,AC","(or press the <Esc> key to cancel this edit session).")
Wait Field
Prompt Prompt1, Prompt2
Until "Enter", "Esc", "F2"
If retval = "Esc"
then Del
Clear Clearall
Quit
Endif
Endif
Else Quitloop
Endif
Endwhile
Endproc
Writelib Libname Required_Fields
Release procs Required_Fields
?? ""
; ---- Extract new printer codes designated by user
Proc New_Codes()
View "Answer"
PrinterName = [NAME]
Orientation = [ORIENTATION]
Pitch = [PITCH]
Port = [PORT]
Setup = [SETUP]
Length = [LENGTH]
PrintType = [CODE]
Confirm_Configuration() ; simply setting the default printer
Endproc
Writelib Libname New_Codes
Release procs New_Codes
?? ""
; ---- Configure the printer
Proc Configure_Printer()
Private Choice ;- user's choice
Please_Wait("Please wait while information is being extracted")
While true
Reset {Ask} Select PrinterTbl CheckPlus
Moveto [PICK] "X"
Do_It!
If not isempty("Answer")
then New_Codes()
If YN = "YES"
then Prompt_Descriptions() ; determine the proper variables
Assign_PrinterCodes()
Quitloop
else Loop
Endif
Else Select_Printer()
Loop
Endif
Quitloop
Reset {Ask} Select PrinterTbl "Delete"
Moveto [NAME] "Blank"
Do_It!
Endwhile
Please_Wait("Please wait while printer is being configured")
Endproc
Writelib Libname Configure_Printer
Release procs Configure_Printer
?? ""
; ---- Add new printer configuration to printer table
Proc Add_Printer()
Pickform 1
End
CtrlPgDn
[ORIENTATION] = Orientation
[PITCH] = Pitch
Prompt_Descriptions()
While True
Wait table
Prompt "Please enter the information for " + PaperLength + "-sized paper, " + Pitch,
"characters per inch), and " + Orientation + " orientation."
Until "F2", "Esc", "Del", "DOS", "DOSBig"
Switch
Case RetVal = "F2" : NumRecs = Nrecords(PrinterTbl)
Required_Fields("NAME")
Required_Fields("LENGTH")
Required_Fields("TYPE")
Required_Fields("SETUP")
FormKey
Required_Fields("PORT")
If NumRecs >= NRecords(PrinterTbl) ; If record was not deleted
Then [PICK] = "X"
Endif
Do_It!
Reset {Ask} Select PrinterTbl CheckPlus
Moveto [PICK] "X"
Do_It!
New_Codes()
QuitLoop
Case RetVal = "Del" : Beep ;- Get the user's attention
Showmenu ;- Trap for accidental deletions
"Cancel": " Cancel Deletion: Do not delete this record",
"Delete": " It is okay to delete this record"
To choice
If choice = "Delete" ;- only delete record if confirmed
Then Del
CtrlPgDn
CtrlHome
Loop
Endif
Case RetVal = "Esc" : CancelEdit
Clear Clearall
Quit
Case RetVal = 15 ;- Trap for user entering Alt-O
or Retval = -24 : Beep ;- or Ctrl-O in error
EndSwitch
Quitloop
EndWhile
Endproc
Writelib Libname Add_Printer
Release procs Add_Printer
?? ""
; ---- If default configuration is assigned, have user confirm that it is correct
Proc Confirm_Configuration()
While true
Cursor box
Clear Clearall
Paintcanvas Attribute 00 00, 00, 24, 79 Style Attribute 15 ; Draw black canvas
Paintcanvas Attribute 63 01, 06, 23, 71 ; white on cyan
@ 00,06 ?? Fill("\220",67) ; Use Ascii
@ 23,06 ?? Fill("\223",67) ; characters
For X From 0 TO 21 ; to create frame:
@ (X+1), 06 ?? "\219" ; 223 ▀
@ (X+1), 72 ?? "\219" ; 219 █
EndFor ; 220 ▄
Style Attribute 63 ; White on cyan
@ 2,10 ?? "Your reports have been configured with the following setup:"
Style Attribute 48 ; Black on cyan
@ 5,15 ?? "PRINTER TYPE: " + PrinterName
@ 7,15 ?? "PORT: " + Port
@ 9,15 ?? "SETUP STRING: " + Setup
@ 11,15 ?? "PAGE LENGTH: " + Length
@ 13,15 ?? "PITCH: " + Pitch
@ 15,15 ?? "ORIENTATION: " + Orientation
Style Attribute 03
@ 21,12 ?? "Press the <Enter> key when finished (or <Esc> to quit)."
Style Attribute 15 ; white on black
@ 18,10 ?? "Is this information correct? Please answer Yes or No: " ; relates to the above question
Style Attribute 11 Accept "A3" Required picture "{YES,NO}" to YN
; Return if user pressed Escape key ... Otherwise, process
If retval = False ; Return if user pressed escape key
Then return
Else If YN = "YES"
Then Update_ReportStrings()
Quitloop
Else Select_Printer()
Quitloop
Endif
Endif
Quitloop
Endwhile
Endproc
Writelib Libname Confirm_Configuration
Release procs Confirm_Configuration
?? ""
; ---- automatically update all reports as specified by the user
Proc Update_ReportStrings()
Please_Wait("Please wait while the reports are being configured")
Setdir Directory() ; delete all temporary tables
{Tools} {Info} {Inventory} {Files} {*.r*}
{Modify} {Restructure} {List} Down Del Down "Tbl" Enter "A8" Enter
"Reptnum" Enter "A3" Do_It!
While not isblank(Window())
Enter
Endwhile
Edit "List"
Scan
Fix = Match([Name],"..\".r\"..",Tbl,Reptnum)
If isblank(Reptnum)
then Reptnum = "R"
Endif
If Fix
then [Tbl] = Tbl
[Reptnum] = Reptnum
Endif
Endscan
Do_It!
View "List"
CurrentRecord = 1
While CurrentRecord <= NRecords("list")
Moveto Record CurrentRecord
Tbl = [Tbl]
Reptnum = [Reptnum]
Menu {Report} {Change} Select Tbl Select Reptnum Select Menuchoice()
Menu {Setting} {PageLayout} {Length} CtrlBackSpace Typein Length Enter
Menu {Setting} {Setup} {Custom} Select Port CtrlBackSpace Typein Setup Enter
Do_It!
UpImage
CurrentRecord = (CurrentRecord + 1)
Loop
Endwhile
Endproc
Writelib Libname Update_ReportStrings
Release procs Update_ReportStrings
?? ""
; ---- Confirm type of printer designated by user
Proc Check_Printer()
Private Keypressed, Prompt1, Prompt2, Prompt3, Prompt4,
Prompt5, Prompt6, Prompt7A, Prompt7B
While true
Paintcanvas Attribute 00 00, 00, 24, 79 Style attribute 15 ; black
Reset {Ask} Select PrinterTbl CheckPlus
Moveto [PICK] "X"
Do_It!
Prompt1 = " Press any key when ready. "
Prompt2 = "P R E S S A N Y K E Y W H E N R E A D Y"
Prompt3 = "Please fill "+PaperLength+"-sized paper tray and place in printer."
Prompt4 = "Locate buttons on right-hand panel."
Prompt5 = "Press the On-Line button until the light goes out."
Prompt6 = "Press the On-Line button until the light goes on."
Prompt7A = "Press the second button in from the left (labeled Reset) until the"
Prompt7B = "word Reset appears above."
If not Isempty("Answer")
Then View "Answer"
Length = [LENGTH]
Setup = [SETUP]
Port = [PORT]
Cursor off
Clear Clearall
If not isblank(PrintType)
Then Switch
Case PrintType = "1" : Laser_Printer("I")
Case PrintType = "2" : Laser_Printer("II")
Case PrintType = "3" : Laser_Printer("III")
Case PrintType = "4" : DotMatrix_Printer()
Case PrintType = "5" : Miscellaneous_Printer()
Endswitch
Else Miscellaneous_Printer()
Endif
Else Quitloop
Endif
Clear Clearall
If not PrinterStatus()
Then Printer_Offline()
Else Please_Wait("Please wait while the reports are being configured")
Endif
Quitloop
Endwhile
Style Attribute 12 Beep
Cursor Normal
Endproc
Writelib Libname Check_Printer
Release procs Check_Printer
?? ""
; ---- Ascertain whether or not printer is online
Proc Printer_Offline()
Paintcanvas Attribute 00 00, 00, 24, 79 Style attribute 15 ; black
Draw_Box("Wide", 63, 03, 11, 21, 64, "", "")
@ 15,28 ?? "Turn on the printer." ; if not, apprise user accordingly
Style attribute 48
@ 11,22 ?? "Please make sure that the printer"
@ 12,22 ?? "is filled with " + PaperLength + "-sized paper."
Draw_Box("Wide", 15, 06, 20, 08, 56, "", "")
Style attribute 139
@ 07,24 ?? "THE PRINTER IS OFF - LINE!"
Style attribute 03
@ 18,24 ?? Prompt1
Keypressed = Getchar()
Please_Wait("Please wait while the reports are being configured")
Endproc
Writelib Libname Printer_Offline
Release procs Printer_Offline
?? ""
; ---- Provide on-screen instructions for using dot-matrix printer
Proc DotMatrix_Printer()
Paintcanvas Attribute 00 00, 00, 24, 79 Style attribute 15 ; black
Draw_Box("Wide", 63, 05, 06, 19, 70, "", "") ; White on cyan
@ 13,28 ?? "Turn on the printer."
Style attribute 48 ; Black on cyan
@ 08,13 ?? "Please make sure that the printer is filled with"
@ 09,13 ?? "paper, aligned with the perforation parallel to the"
@ 10,13 ?? "ribbon guide (just beneath the paper bail lever)."
Style Attribute 03 @ 16,25 ?? Prompt1
Style Attribute 131 @ 16,17 ?? "\07 \07 \07 \07 " @ 16,52 ?? " \07 \07 \07 \07"
Keypressed = Getchar()
Endproc
Writelib Libname DotMatrix_Printer
Release procs DotMatrix_Printer
?? ""
; ---- Provide on-screen instructions for printing with HP compatible laser jet
Proc Laser_Printer(Series)
Paintcanvas Attribute 00 00, 00, 24, 79 Style attribute 15 ; black
Draw_Box("Double", 04, 00, 00, 24, 79, 22, "")
Switch
Case Upper(Series) = "I" :
@ 10,04 ?? "\04" @ 13,04 ?? "\04" @ 18,04 ?? "\04"
Cross_Line("DoubleSingle",02,00,79)
Cross_Line("DoubleSingle",05,00,79) Cross_Line("DoubleSingle",20,00,79)
Style Attribute 15 ; White on black
@ 1,11 ?? Prompt3 @ 6,21 ?? Prompt4 @ 8,15 ?? Prompt5 @ 21,16 ?? Prompt6
Style Attribute 04 ; Red on black
@ 3,10 ?? "Insert a " + Font + " font cartridge. (If your fonts do not have"
@ 4,10 ?? "graphics capability, the reports will print without boxes.)"
Style Attribute 07 ; Light grey on black
@ 10,08 ?? "Slowly press menu button on right; continue doing so until you see"
@ 11,08 ?? "the words FONT SOURCE."
@ 13,08 ?? "If the " + Font + " cartridge was inserted in the left side, the font"
@ 14,08 ?? "source is `L'; if in the right side, it is `R'. Press the manual"
@ 15,08 ?? "button (located above the menu button) until the proper letter"
@ 16,08 ?? "appears."
@ 18,08 ?? Prompt7A @ 19,08 ?? Prompt7B
Otherwise :
If Upper(Series) = "II"
then SymSet = "IBM - US"
else SymSet = "PC - 8"
Endif
@ 08,03 ?? "\04" @ 12,03 ?? "\04" @ 16,03 ?? "\04"
Cross_Line("DoubleSingle",02,00,79) Cross_Line("DoubleSingle",06,00,79)
Cross_Line("DoubleSingle",20,00,79)
@ 3,21 ?? Prompt4 @ 5,15 ?? Prompt5
Style Attribute 15 @ 1,11 ?? Prompt3 @ 21,16 ?? Prompt6 ; White on black
Style Attribute 07
@ 08,06 ?? "Slowly press Menu button on right; continue doing so until you see the"
@ 09,06 ?? "words FONT SRC. If this does not read `I', hold down the Alt key and"
@ 10,06 ?? "press the +/- buttons until `I' appears. Press the Enter button."
@ 12,06 ?? "Press menu button until you words FONT NUM. If this does not read"
@ 13,06 ?? "`FONT NUM 00', hold down the Alt key and press the +/- buttons until"
@ 14,06 ?? "this appears. Press the Enter button."
@ 16,06 ?? "Hold down Menu button until you see the words SYM SET. If this does"
@ 17,06 ?? "not read `SYM SET = " + SymSet + "', press Alt/+- buttons until this appears."
@ 18,06 ?? "Press the Enter button."
EndSwitch
Paintcanvas Attribute 79 23, 01, 23, 78 Style Attribute 79 @ 23,15 ?? Prompt2
Style Attribute 192 @ 23,06 ?? "\04 \04 \04 \04" @ 23,68 ?? "\04 \04 \04 \04"
Keypressed = Getchar()
Endproc
Writelib Libname Laser_Printer
Release procs Laser_Printer
?? ""
; ---- provide on-screen instructions for using unknown printer
Proc Miscellaneous_Printer()
Paintcanvas Attribute 00 00, 00, 24, 79 Style attribute 15 ; black
Draw_Box("Double", 04, 01, 07, 23, 71, 21, "")
@ 12,14 ?? "\04" @ 14,14 ?? "\04"
Cross_Line("DoubleSingle",07,07,71) Cross_Line("DoubleSingle",17,07,71)
Style Attribute 07
@ 12,18 ?? "Check your printer manual for directions."
@ 14,18 ?? "If graphics fonts are unavailable, the reports "
@ 15,18 ?? "will simply be printed without boxes."
Style Attribute 15
@ 3,14 ?? "Fill the printer with " + PaperLength + "-sized (8 1/2 x 11-inch)"
@ 4,14 ?? "paper. (If your printer has a ribbon guide, align"
@ 5,14 ?? "the paper with the top edge parallel to the guide.)"
@ 9,18 ?? "Set the printer for " + Pitch + "H)"
@ 10,18 ?? "(preferably with graphics capability)."
@ 19,15 ?? Prompt6
Paintcanvas Attribute 79 22, 08, 22, 70
Style Attribute 79 @ 22,16 ?? "P R E S S A N Y K E Y W H E N R E A D Y"
Style Attribute 192 @ 22,09 ?? "\07 \07 \07" @ 22,65 ?? "\07 \07 \07"
Keypressed = Getchar()
Endproc
Writelib Libname Miscellaneous_Printer
Release procs Miscellaneous_Printer
?? ""
; ---------------------------------------------------------------------------------------
; SHOW MESSAGE TO PREVENT IMPATIENT USERS FROM WREAKING HAVOC
; (A generic procedure utilized by the printer utility, but useful in any application.)
; ---------------------------------------------------------------------------------------
Proc Please_Wait(WaitMssg) ; Tell user what is happening
Cursor Off ; Do not show cursor
Clear Clearall ; Clear screen and canvas
PaintCanvas Attribute 00 00, 00, 24, 79 ; Draw black background
PaintCanvas Attribute 112 10, 07, 14, 75 ; Draw grey shadow
PaintCanvas Attribute 48 09, 04, 13, 73 ; Draw cyan box
Style Attribute 176 ; Draw blinking black characters
@ 11,05 ?? " \07 \07 \07 " ; (Ascii code 7)
@ 11,66 ?? " \07 \07 \07 " ; (Ascii code 7)
Style Attribute 48 ; Show black lettering
@ 11,13 ?? Format("AC,CC,W52",Strval(Waitmssg)) ; Center message (capitalizing
Endproc ; first letter of each word)
Writelib Libname Please_Wait
Release Procs Please_Wait
?? ""
; ---------------------------------------------------------------------------------------
; DRAW A COLORED BOX AT GIVEN COORDINATES
; (A generic procedure utilized by the printer utility, but useful in any application.)
; ---------------------------------------------------------------------------------------
Proc Draw_Box(LineType,BoxColor,StartRow,StartColumn,Endrow,EndColumn,FirstCross,NextCross)
Private FillNum, ; Number of horizontal characters to fill in
X ; A counter
; --- Determine the number of horizontal characters to fill in between starting and ending
; columns
Fillnum = (EndColumn - StartColumn -1)
; --- Determine appropriate character for each part of the box (e. g., for each type of
; line (single, double, and wide), the upper lefthand corner, upper right hand corner,
; lower left hand corner, lower right hand corner, horizontal, and vertical ... As the
; wide lines distinguish betwen horizontal "top" and "bottom" characters, both
; HorizontalTop and HorizontalBottom are cited.
Switch
Case Upper(LineType) = "SINGLE": UpperLeft = "\218" UpperRight = "\191"
LeftCross = "\195" RightCross = "\180"
LowerLeft = "\192" LowerRight = "\217"
HorizontalTop = "\196" HorizontalBottom = "\196"
Vertical = "\179"
Case Upper(LineType) = "DOUBLE": UpperLeft = "\201" UpperRight = "\187"
LeftCross = "\204" RightCross = "\185"
LowerLeft = "\200" LowerRight = "\188"
HorizontalTop = "\205" HorizontalBottom = "\205"
Vertical = "\186"
Case Upper(LineType) = "WIDE": UpperLeft = "\219" UpperRight = "\219"
LeftCross = "\219" RightCross = "\219"
LowerLeft = "\219" LowerRight = "\219"
HorizontalTop = "\223" HorizontalBottom = "\220"
Vertical = "\219"
EndSwitch
; --- Specify the color in which to draw the box
PaintCanvas Attribute BoxColor StartRow, StartColumn, EndRow, EndColumn Style Attribute BoxColor
; --- At the designated coordinate, draw the top line of the box
@ StartRow, StartColumn ?? UpperLeft, Fill(HorizontalTop,FillNum), UpperRight
; --- Fill in with vertical lines extending from the starting row to the ending row
For X From (StartRow + 1) to (EndRow - 1)
@ X,StartColumn ?? Vertical ; Vertical lines at the "starting" column
@ X,EndColumn ?? Vertical ; Vertical lines at the "ending" column
EndFor
; --- If applicable, add intersecting horizontal "crosslines"
If not isblank(FirstCross)
Then @ FirstCross, StartColumn ?? LeftCross, Fill(HorizontalTop,FillNum), RightCross
If not isblank(NextCross)
Then @ NextCross, StartColumn ?? LeftCross, Fill(HorizontalTop,FillNum), RightCross
Endif
Endif
@ EndRow, StartColumn ?? LowerLeft, Fill(HorizontalBottom,FillNum), LowerRight
Endproc
Writelib Libname Draw_Box
Release procs Draw_Box
?? ""
; --- If desired, an additional horizontal line may be drawn across the canvas (Since this is
; the exception rather than the rule, it is separated from the "main" box-making
; procedure to prevent wasting space with seldom- used variables)
Proc Cross_Line(LineType,StartRow,StartColumn,EndColumn)
Private FillNum, ; Number of characters to fill in
X ; A counter
; --- Determine the number of horizontal characters to fill in between starting and ending
; columns
Fillnum = (EndColumn - StartColumn -1)
; --- Determine appropriate "crossline" character for each part of the box (e. g., for
; each type of line (single, double, and wide), the left-hand side character, the
; right-hand side character, and the horizontal character)
Switch
Case Upper(LineType) = "SINGLE" : LeftCross = "\195" ; ├
HorizontalCross = "\196" ; ─
RightCross = "\180" ; ┤
Case Upper(LineType) = "DOUBLE" : LeftCross = "\204" ; ╠
HorizontalCross = "\205" ; ═
RightCross = "\185" ; ╣
Case Upper(LineType) = "WIDE" : LeftCross = "\219" ; █
HorizontalCross = "\223" ; ▀
RightCross = "\219" ; █
Case Upper(LineType) = "DOUBLESINGLE" : LeftCross = "\199" ; ╟
HorizontalCross = "\196" ; ─
RightCross = "\182" ; ╢
EndSwitch
; --- At the designated coordinate, draw the specified line
@ StartRow, StartColumn ?? LeftCross, Fill(HorizontalCross,Fillnum), RightCross
Endproc
Writelib libname Cross_Line
Release procs Cross_Line
?? ""
; ╔══════════════════════════════════════════════════════════════════════════════════════╗
; ║ EXAMPLE(S) ║
; ║ This procedure should appear in two segments of your main menu: ║
; ╟──────────────────────────────────────────────────────────────────────────────────────╢
; ║ (1) If all of the options in your main report menu have the same format, ║
; ║ invoke the utility just before calling your main report menu (with variable ║
; ║ PrintNow "Yes") ║
; ║ ║
; ║ (This will prevent repeatedly asking the user to confirm printing ║
; ║ configuration, as would be the case if the procedure were called before ║
; ║ each report was printed.) ║
; ║ ║
; ║ For example, to print Samples table report number 1, using vertical, letter- ║
; ║ sized paper and standard print, with a table named printer in subdirectory ║
; ║ Lookup: ║
; ║ Autolib = "Print" ║
; ║ Setup_Printer("Portrait","Pica","11","Lookup\\Printer","Yes") ║
; ║ Report "Samples" "1" ║
; ║ ║
; ║ N. B. Although it may appear more efficient to print the reports from ║
; ║ within the setup procedure, this would have necessitated asking the ║
; ║ user to confirm his printer and setup string for each and every ║
; ║ report being printed. For this reason, it was obviously avoided. ║
; ╟──────────────────────────────────────────────────────────────────────────────────────╢
; ║ (2) The system's main or utility menu should include a separate "Change ║
; ║ Configurations" option to enable users to define default printer settings ║
; ║ with variable PrintNow "No") ║
; ║ ║
; ║ As a separate (main or utility menu) option to define default printer ║
; ║ configuratrions (with variable PrintNow "No") ║
; ║ ║
; ║ (For example, when a user receives a new printer or is given access to ║
; ║ a LAN, he or she might want to enter the respective codes at that time, ║
; ║ rather than waiting until it is time to print reports) ║
; ║ ║
; ║ For example, to configure (but not yet print) horizontal reports, using ║
; ║ condensed print and legal-sized paper, with a table named printer in the ║
; ║ current directory: ║
; ║ Autolib = "Print" ║
; ║ Setup_Printer("Landscape","Condensed","14","Printer","No") ║
; ╚══════════════════════════════════════════════════════════════════════════════════════╝
; VARIATION(S)
; Obviously, these procedures can be modified to accomodate your own setups and
; methodology.
; If this utility is to be included in a timed application, ensure that it is
; invoked during normal business hours. (For example, an application set to
; automatically run at midnight on the first day of each month would pause until
; someone confirmed the configurations ... It would therefore be more prudent to
; instead incorporate this utility in a separate module set to run during business
; hours on the last business day of the preceding month.)